package com.jews.example.demo.infrastructure.constants;


import com.jews.common.constants.BaseEnum;

import java.util.Optional;

/**
 * User业务异常错误码枚举
 *
 * @author JewsChen
 * @title: UserErrorCode
 * @date 2022/11/30 0:21
 */
public enum UserErrorCode implements BaseEnum<UserErrorCode> {

    /**
     * xxx
     */
    xxx(1001000, "name");

    UserErrorCode(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private final Integer code;
    private final String name;

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<UserErrorCode> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(UserErrorCode.class, code));
    }

}
